import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

/* Layout */

// 公共路由
export const constantRoutes = [
  {
    path: '/',
    component: (resolve) => require(['@/views/login/login'], resolve),
    hidden: true,
  },
  {
    path: '/login',
    component: (resolve) => require(['@/views/login/login'], resolve),
    hidden: true,
  },
  {
    path: '/home',
    component: (resolve) => require(['@/views/home/index'], resolve),
    hidden: true
  },
  {
    path: '/404',
    component: (resolve) => require(['@/views/error/404'], resolve),
    hidden: true
  }]

function getRouters() {
  let constantRoutesLast = constantRoutes;
  return constantRoutesLast;
}

export default new Router({
  mode: 'history', // 去掉url中的#
  scrollBehavior: () => ({
    y: 0
  }),
  routes: getRouters()
})
